<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<script type="text/javascript">
	//初始化表单验证
	/* $("#addForm").validate({
		messages : {
			active_title : {
				required : "请输入活动标题"
			},
			start : {
				required : "请输入开始时间"
			},
			stop : {
				required : "请输入结束时间"
			}

		},
		submitHandler : function(form) {
			$(form).ajaxSubmit({
				success : function(data) {
					switch (data.flag) {
					case -1:
						Kit.alert("网络繁忙...，请重试");
						return;
					case 0:
						dataPaginators.loadPage(1);
						addDialog.close();
					}
				}
			});
		}
	}); */
</script>
<label class="search-label">品牌名称:</label>
<input type="text" id="btitle" value=""
	class="form-control search-input width140" maxlength="21"
	placeholder="请输入商品名">
<button class="btn btn-success search-btn" onclick="query1();">确定</button>
<button class="btn btn-success search-btn" onclick="reset1();">重置</button>



<div class="col-lg-6 col-lg-offset-6">
	<div class="pull-right">
		<button type="button" class="btn btn-success" onclick="doAddObject()">
			<span class="fa fa-save"></span>保存添加
		</button>
	</div>
</div>


<form id="addForm" action="${BASE_PATH}/spike/recommend/doAddObject"
	method="post" class="form-horizontal">
	<!-- <input type="hidden" name="saveId" value="id"> -->
	<div class="row">
		<div class="col-lg-12">
			<!-- <h1 class="page-header">添加商品</h1> -->
		</div>
		<!-- <div class="col-lg-6 col-lg-offset-6">
			<div class="pull-right">
				<button type="button" class="btn btn-success" onclick="toAddGoods()">
					<span class="fa fa-save"></span>保存添加
				</button>
			</div>
		</div> -->
	</div>
	<div class="row">
		<div class="col-lg-12">
			<div class="text-muted single-line-text pull-left">
				共 <font color="#428bca" id="dataCounts">0</font> 条记录
			</div>
		</div>
	</div>


	<div class="table-responsive">
		<table id="dataTable" class="table table-striped table-hover">
			<thead>
				<tr>
					<th width="40%">品牌名称</th>
		
					<th width="20%">操作</th>
				</tr>
			</thead>
			<tbody id="dataLists"></tbody>
		</table>
	</div>
	<div class="row">
		<div class="col-lg-12">
			<ul id="dataPaginations" class="pagination-sm pull-right"></ul>
		</div>
	</div>



	<script type="text/html" id="datal">
		{{each list as item}}
	<tr id="item{{item.id}}" data-id="{{item.id}}">
		<td>{{item.sellerName}}</td>
		<td><p><input type="checkbox" id="check" name="checkbox" value="{{item.id}}" ></p></td>
	</tr>
	{{/each}}
</script>
	<div class="row">
		<!--  <div class="col-lg-6">
			<button class="btn btn-primary col-sm-3 pull-right" type="submit"
				autocomplete="off">提交</button>
		</div>  -->
		<div class="col-lg-6">
			<button class="btn btn-default col-sm-3 pull-left" type="button"
				onclick="closes();" autocomplete="off">返回</button>
		</div>
	</div>
 

	<script type="text/javascript">
		var dataPaginators;
		$(query1);
		function query1() {
			var params = {
				pageSize : 10,
				group:1,
				title : $("#btitle").val()
			};
			if (dataPaginators) {
				dataPaginators.destroy();
			}
			dataPaginators = Kit.pagination("#dataPaginations",
					"${BASE_PATH}/spike/recommend/OutSidePage", params, function(result) {
						//设置显示最新的数据数量
						$("#dataCounts").html(result.object.totalRow);
						//根据模板渲染数据并填充
						$("#dataLists").empty().append(
								template("datal", result.object));
					});

		}

		
		function reset1() {
			$("#btitle").val("");
		}
		
			
		/* function addcookie(){ */
				/* var checkedIds=[];
			$("#check input").click(function(){
		       
		        if($(this).is(":checked")){
		        	checkedIds.push($(this).attr("id"));
		        }else{
		        	for(var i=0;i<checkedIds.length;i++){
		        		if($(this).attr("id")==checkedIds[i]){
		        			checkedIds.splice(i,1);
		        			break;
		        		}
		        	}
		        }
			}); */
			 
		       
			
		function doAddObject() {
			
			 $("#addForm").ajaxSubmit 
	
			({ 
				success : function(data) {
					switch (data.flag) {
					case -1:
						Kit.alert("网络繁忙...，请重试");
						return;
					case 1:
						Kit.alert("数据异常！！");
						return;
					case 0:
						/* window.location.reload(); */
						query1();
					}
				}

			});

		}
			
		function closes(){
			addDialog.close();
			window.location.reload();			
		}
	
	</script>
<input type="hidden" name="group" value="${group}"/>
</form>

